package team526.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import team526.dao.AdminDao;
import team526.dao.VideoDao;
import team526.entity.Video;
import team526.service.AdminService;

import java.util.Date;

/**
 * Date 2021/11/6 - 0:47
 *
 * @author 王铭 20181620310021
 */
@Service
public class AdminServiceImpl implements AdminService {
    @Autowired
    VideoDao videoDao;
    @Autowired
    AdminDao adminDao;

    @Override
    public Integer check(Integer videoid, Boolean pass, String reason, Integer uadmin_id) {
        Video video=videoDao.getVideoById(videoid);
        video.setStatus(2);
        if (pass)
            video.setStatus(1);
        videoDao.updateVideo(video);
        return adminDao.addCheck(videoid,pass,reason,uadmin_id,new Date());
    }
}
